﻿<%@ Page  Culture="zh-CN" Title="" Language="C#" MasterPageFile="~/Default.master" AutoEventWireup="true" CodeBehind="Combine.aspx.cs" Inherits="FastShip88.Combine" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Main" runat="server">

    <div class="shim column"></div>

      <div class="page" id="inbound_query">
          
		<div id="content_one_col">
		   
            <asp:Label ID="Label1" runat="server" Text="下面列出所有到站包裹，不包含已拆分的包裹：" CssClass="gv_prompt"></asp:Label>&nbsp;
            <br /><br />
            <div id="div_parcels" runat="server" >
                <asp:GridView ID="gvResults" runat="server" AutoGenerateColumns="False" 
                    DataKeyNames="Id" DataSourceID="LinqDataSource1" Width="980px"  
                    EmptyDataText="没有数据！" CellPadding="1" 
                    AllowPaging="True" PageSize="5" 
                    onpageindexchanging="gvResults_PageIndexChanging"  >
                    <Columns>

                       <asp:TemplateField ItemStyle-Width ="30px" >
                            <HeaderTemplate>
                                
                                选择
                             </HeaderTemplate><ItemTemplate>
                                <asp:CheckBox ID="chkSelect" runat="server" OnCheckedChanged = "CheckBox_CheckedChanged"  AutoPostBack = "true" />
                            </ItemTemplate>

                            <ItemStyle Width="30px" HorizontalAlign="Center"></ItemStyle>
                        </asp:TemplateField>
                        
                        <asp:BoundField DataField="id" HeaderText="系统编号">
                        <ItemStyle Width="60px" />
                        </asp:BoundField>

                        <asp:BoundField DataField="ParcelNo" HeaderText="运单号" ReadOnly="True" 
                            SortExpression="ParcelNo">
                        <ItemStyle Width="160px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Name" HeaderText="商家" ReadOnly="True">
                        <ItemStyle Width="100px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Description" HeaderText="描述" ReadOnly="True" 
                            SortExpression="Description">
                        <ItemStyle Width="240px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Weight" HeaderText="重量" ReadOnly="True" 
                            SortExpression="Weight" Visible="True">
                        <ItemStyle Width="60px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="ArriveDate" HeaderText="到达日期" ReadOnly="True" 
                            SortExpression="ArriveDate" DataFormatString="{0:d}">
                        <ItemStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" 
                            SortExpression="Id" Visible="False" />
                        <asp:BoundField DataField="StatusName" HeaderText="状态">
                        <ItemStyle Width="100px" />
                        </asp:BoundField>
                        
                     </Columns>
                    <SelectedRowStyle BackColor="#669999"  />
                    <HeaderStyle BackColor="#999999" ForeColor="White" />
                </asp:GridView>
                <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
                    ContextTypeName="FastShip88.DBAccess.UsersDataContext" 
                    Select="new (ParcelNo, Description, ShopInfo, Weight, ArriveDate, Id, UserId, ShopId)" 
                    TableName="ParcelInfos">
                </asp:LinqDataSource>
                <hr />
            </div>
            
            
            <div id="div_sub" runat="server" visible="true" >
            <asp:Label ID="Label2" runat="server" Text="下面列出所有拆分子包裹："   CssClass="gv_prompt"></asp:Label>&nbsp;<br /><br />
                <asp:GridView ID="gvSub" runat="server" AutoGenerateColumns="False"  EmptyDataText="目前还没有子包裹。" 
                    Width="980px" DataKeyNames="Id" DataSourceID="LinqDataSource2" 
                    AllowPaging="True" onpageindexchanging="gvSub_PageIndexChanging" PageSize="5">
                    <Columns>
                        <asp:TemplateField ItemStyle-Width ="30px">
                            <HeaderTemplate>
                                
                                选择
                             </HeaderTemplate><ItemTemplate>
                                <asp:CheckBox ID="chkSelect" runat="server" OnCheckedChanged = "CheckBox_CheckedChanged"  AutoPostBack = "true" />
                            </ItemTemplate>

                            <ItemStyle Width="30px" HorizontalAlign="Center"></ItemStyle>
                        </asp:TemplateField>
                        <asp:BoundField DataField="id" HeaderText="系统编号">
                        <ItemStyle Width="60px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Description" HeaderText="描述">
                        <ItemStyle Width="420px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Weight" HeaderText="重量">
                        <ItemStyle Width="60px" />
                        </asp:BoundField>
                         <asp:BoundField DataField="ParcelNo" HeaderText="父包裹运单号" ReadOnly="True" 
                            SortExpression="ParcelNo">
                        <ItemStyle Width="160px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="CreateDate" HeaderText="拆分日期" 
                            DataFormatString="{0:d}">
                        <ItemStyle Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="FinishDate" HeaderText="完成日期" 
                            DataFormatString="{0:d}">
                        <ItemStyle Width="80px" />
                        </asp:BoundField>
                    </Columns>
                <SelectedRowStyle BackColor="#669999"  />
                <HeaderStyle BackColor="#999999" ForeColor="White" />

                </asp:GridView>
            
                <asp:LinqDataSource ID="LinqDataSource2" runat="server" 
                    ContextTypeName="FastShip88.DBAccess.UsersDataContext" 
                    TableName="SubParcels" Where="FromId == @FromId" EnableDelete="True">
                    <WhereParameters>
                        <asp:ControlParameter ControlID="gvResults" Name="FromId" 
                            PropertyName="SelectedValue" Type="Int32" />
                    </WhereParameters>
                </asp:LinqDataSource>
                <hr />
            </div>
            
            <div id="div_selected" runat="server" visible="true" >
            <asp:FormView ID="fvSelected" runat="server" DataKeyNames="Id" 
                     DefaultMode="Insert" Width="707px" 
                    onmodechanging="fvSelected_ModeChanging"  >
                    <EditItemTemplate>
                        
             <asp:Label ID="lblCreate" runat="server" Text="新建包裹信息："   CssClass="gv_prompt"></asp:Label><table style="width: 750px;" cellpadding="5">
            <tr>
                <td style="height: 18px; width: 100px">
                    &nbsp;新包裹系统ID： </td><td style="height: 18px; width: 200px">
                    &nbsp;<asp:Label ID="lblId" runat="server" Text='' Visible="false" /></td><td style="height: 18px; width: 340px">
                     
                </td>
            </tr>
        
           <tr>
                <td>
                    &nbsp;描述： </td><td colspan=2 >
                    &nbsp;<asp:TextBox ID="txtDescription" runat="server" Width="500px" Height="36px" Text='<%# Bind("Description") %>' ></asp:TextBox></td>
           </tr>
           <tr>
                <td>
                    &nbsp;海关申报全额： </td><td colspan=2 >
                    &nbsp;<asp:TextBox ID="txtDeclareValue" runat="server" Width="100px" Text='<%# Bind("DeclareValue") %>' ></asp:TextBox>元（人民币）</td>
           </tr>      
           <tr>
                <td>
                    &nbsp;关税金额<font color="red"></font>： </td><td colspan=2 >
                    &nbsp;<asp:TextBox ID="txtTariff" runat="server" Width="100px" Text='<%# Bind("Tariff") %>' ></asp:TextBox>元（人民币）
                    <%--<asp:RequiredFieldValidator  ID="RequiredFieldValidator1" runat="server" 
                        ErrorMessage="请填入关税金额" ControlToValidate="txtTariff"></asp:RequiredFieldValidator>--%>
                </td>
           </tr>  
                <tr>
                <td>
                    &nbsp;重量： </td><td>
                    &nbsp;<asp:Label ID="lblWeight" runat="server" Text='<%# Bind("Weight") %>'></asp:Label></td><td>
                    &nbsp;单位为磅（pound）。 </td></tr></table></div><asp:Button ID="btnCombine" runat="server" Text="合并" 
                onclick="btnCombine_Click" /> &nbsp; <asp:Button ID="btnCombineTransfer" runat="server" Text="合并且中转"  Visible ="false" />
            
                            <asp:Button ID="btnCancel" runat="server" Text="取消" CommandName="Cancel" />

                    </EditItemTemplate>
        
                </asp:FormView>
                
                <asp:ObjectDataSource ID="ObjectDataSource1" runat="server">
                </asp:ObjectDataSource>
                
              <asp:Label ID="lblError" runat="server" Text="出现错误" Font-Bold="True" 
              Font-Size="Medium" ForeColor="#CC0000" Height="30px" Visible="False" 
              Width="500px"></asp:Label>
                
            <asp:Label ID="lblSuccess" runat="server" Text="已成功合并, 新包裹系统ID为：%id" Font-Bold="True" 
              Font-Size="Medium" ForeColor= "Green" Height="30px" Visible="False" 
              Width="500px"></asp:Label>
               
        </div>
    </div>



</div>
</asp:Content>
